// pages/firework/firework.js
const app = getApp()
const util = require('../../utils/util.js')
const storage = require('../../utils/cache.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    current:0,
  },
  onLoad(){
    this.setData({
      imgUrls: app.globalData.gift.fires,
      wishList: app.globalData.gift.blessings
    })
  },
  bindchange: function (e) {//轮播图发生改变
    this.setData({
      current: e.detail
    })
  },
  getContent(e){
    this.setData({
      text: e.detail.content,
    })
  },
  make(e){
    if (util.isEmpty(this.data.text)){
      util.showFail('请选择祝福语')
    }else{
      let data={
        id: this.data.imgUrls[e.detail].i,
        content: this.data.text
      }
      storage.put('two',data)
      wx.navigateTo({
        url: '../package/package',
      })
    }
  },
  onShareAppMessage() {
    return {
      title: '一起来制作2019新年大礼包~',
      path: '/pages/home/home',
      imageUrl: '../../img/share.png',
    }
  },
})